﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace cuoihocsinh
{
    class hocsinh
    {
        private string hoten;
        private float diemtoan;
        private float diemly;
        private float diemhoa;
        private float dtb;
        public hocsinh()
        {
        }
        public string HoTen // đo no khac nhau roi khoi dung this
        {
            get { return hoten; }
            set { hoten = value; }
        }
        public float DiemToan
        {
            get { return diemtoan; }
            set { diemtoan = value; }
        }
        public float DiemLy
        {
            get { return diemly; }
            set { diemly = value; }
        }
        public float DiemHoa
        {
            get { return diemhoa; }
            set { diemhoa=value; }
        }
        public float DTB()
        {
            dtb =(diemtoan + diemly + DiemHoa) /3;// cai nay la conver no qua kieu float nhe ! ko la chia no ra so nguyen do .
            return dtb;
        }
        public void nhap()
        {
            Console.WriteLine("nhap ho ten hoc sinh");
            HoTen = Console.ReadLine();  // nhung dong nay ko can dung this cung dc vi HoTen cua minh tao o ham get ko dong voi ten khai bao o tren
            Console.WriteLine("nhap diem toan");
            DiemToan = float.Parse(Console.ReadLine());
            Console.WriteLine("nhap diem ly");
            DiemLy = float.Parse(Console.ReadLine());
            Console.WriteLine("nhap diem hoa");
            DiemHoa = float.Parse(Console.ReadLine());
        }
        public void xuat()
        {
            Console.WriteLine("ten hos sinh :{0}",HoTen);
            Console.WriteLine("diem toan:{0}", DiemToan);
            Console.WriteLine("diem ly:{0}",DiemLy);
            Console.WriteLine(" diem hoa:{0}",DiemHoa);
            Console.WriteLine("Diem trung binh : "+DTB());
            Console.WriteLine("---------------");
        }
        public void xuatKD()
        {          
           {
                Console.WriteLine("ten hoc sinh :{0}", HoTen);
                Console.WriteLine("diem toan:{0}", DiemToan);
                Console.WriteLine("diem ly:{0}", DiemLy);
                Console.WriteLine("diem hoa:{0}", DiemHoa);
                Console.WriteLine("diem trung binh:{0}", DTB());
            }
        }
    }
}

